﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Common
{
    public abstract class Action
    {    

        public abstract void Execute();
    }

    public class SetCommand : Action
    {
        private Variable variableToSet;
 
        private string value;

        private CommonDataStorage dataStorage;

        public string Value
        {
            get { return value; }
        }

        public Variable VariableToSet
        {
            get { return variableToSet; }
        }


        public SetCommand(Variable VariableToSet, string value)
        {
            variableToSet = VariableToSet;
            this.value = value;
        }

        public override void Execute()
        {
            
            variableToSet.CurrentValue = value;
            //var listOfSelected = from var in dataStorage.Variables
            //                     where var.Name == variableToSet
            //                     select var;
            //if (listOfSelected != null)
            //{
            //    foreach (var c in listOfSelected)//if all works as it should only one iteration
            //    {                              // of this foreach will be performed
            //        c.CurrentValue = value;
            //    }
            //}
            //else
            //{
            //    throw new ArgumentException();
            //}
        }

    }

    public class SendCommand : Action
    {
        private string commandToSend;
        private string parametr;

        public string CommandToSend
        {
            get { return commandToSend; }            
        }

        public string Paramet
        {
            get { return parametr; }
        }
        //private ActionPerformer m_performer;

        public SendCommand(string command, string parametr)
        {
            commandToSend=command;
            this.parametr = parametr;
        }

        public override void Execute()
        {
            //ActionPerformer.PerformAction(this);
            //some network action
        }

    }

   
}
